package com.zhaoguang.car.config;

import com.zhaoguang.car.common.AuthorizationException;
import com.zhaoguang.car.common.RespBean;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@ResponseStatus(HttpStatus.OK)
@RestControllerAdvice
public class ServiceExceptionHandler {

    @ExceptionHandler(AuthorizationException.class)
    public RespBean handleTokenAuthorizationException(AuthorizationException ex) {

        return RespBean.error(ex.getMessage());
    }

}
